import { AxiosCanceler } from '@/utils/http/AxiosCanceler'
import { generateReqKey } from '@/utils/http/utils'
import type { IInternalAxiosRequestConfig } from '@/utils/http/type'

const axiosCanceler = new AxiosCanceler()
export const handleRepeatRequest = async (config: IInternalAxiosRequestConfig) => {
  if (!config.repeatRequest) {
    return
  }
  config.pendKey = generateReqKey(config)
  axiosCanceler.addPending(config)
}
